home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1996 February: Tool Chest / Apple Developer CD Series Tool Chest February 1996 (Apple Computer)(1996).iso / Sample Code / AOCE Sample Code / Standard Catalog Package / DTS AddressOMatic / Src / ErrorAlert.c < prev    next >
Encoding:
C/C++ Source or Header  |  1994-06-23  |  1.0 KB  |  50 lines  |  [TEXT/KAHL]

  1. /*                                    ErrorAlert.c                                */
  2. /*
  3.  * DTS AddressOMatic Sample
  4.  * ErrorAlert.c
  5.  * Copyright © 1993 Apple Computer Inc. All rights reserved.
  6.  *
  7.  * Display an error message.
  8.  */
  9.  
  10. #include "AddressOMaticTest.h"
  11.  
  12. void
  13. ErrorAlert(
  14.         short                alrtResId,
  15.         OSErr                errorValue,
  16.         ConstStr255Param    errorText
  17.     )
  18. {
  19.         Str15                errorValueText;
  20.         Str255                macErrorText;
  21.         Handle                macErrorHdl;
  22.         
  23.         NumToString(errorValue, errorValueText);
  24.         macErrorHdl = GetResource('Estr', errorValue);
  25.         if (macErrorHdl == NULL)
  26.             macErrorText[0] = 0;
  27.         else {
  28.             pstrcpy(macErrorText, (StringPtr) *macErrorHdl);
  29.             ReleaseResource(macErrorHdl);
  30.         }
  31.         PositionDialog('ALRT', alrtResId);
  32.         ParamText(
  33.             errorValueText,
  34.             macErrorText,
  35.             (errorText == NULL) ? "\p" : errorText,
  36.             "\p"
  37.         );
  38.         InitCursor();
  39.         if (Alert(alrtResId, NULL) == cancel) {
  40.             /*
  41.              * When we have open files, this might
  42.              * be changed to let the user have a last
  43.              * chance to save files. On the other hand,
  44.              * only the "Fatal Error" alert has a
  45.              * cancel button.
  46.              */
  47.             ExitToShell();
  48.         }
  49. }
  50.